import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

const module = {
    state: {
        city: '北京朝阳区',
        phone: '17701269859',
        num: 5,
        address: [],
        commonTools: [],
        pas: '',
        obj: [{
            headPic: "http://mobile.bwstudent.com/images/small/default/user.jpg",
            nickName: "王丽雅",
            phone: "13733336666",
            sessionId: "161059033246784332",
            sex: 1,
            userId: 84332,
            addressId: "",
        }],
        // 地址
        wadd1: [{
            label: '收货人姓名:',
            input: [{
                in: '请输入收货人姓名',
                names: ''
            }]
        }, {
            label: '所在地区:',
            input: [{
                in: '省',
                oblast: ''
            }, {
                in: '市',
                city: ''
            }, {
                in: '区/县',
                country: ''
            }]
        }, {
            label: '详细地址:',
            input: [{
                in: '用于接收货物的详细信息',
                detail: ''
            }]
        }, {
            label: '联系电话:',
            input: [{
                in: '推荐请输入手机号',
                phone: '',
            }]
        }, {
            label: '或固定电话:',
            input: [{
                in: '区号',
                stel1: '',
            }, {
                in: '电话号码',
                stel2: '',
            }]
        }],
        wly: [{
            warr1: ['订单提交成功', '确认订单信息', '我的购物车'],
            ads: '',
            zong: 0,
            addDef: '',
            warrImg: [],
            goods1: [{
                ng: '爱果果水果店',
                ng1: '规格',
                ng2: '单价',
                ng3: '数量',
                ng4: '金额',
                ng5: '操作',
                tot: 0,
                list: [{
                    ngs: '云南蒙自石榴8个装',
                    gu1: '8个装',
                    gu2: 569,
                    gu3: 1,
                    gu4: '删除',
                    gu5: 0
                }, {
                    ngs: '云南蒙自石榴8个装',
                    gu1: '8个装',
                    gu2: 569,
                    gu3: 1,
                    gu4: '删除',
                    gu5: 0

                }, {
                    ngs: '云南蒙自石榴8个装',
                    gu1: '8个装',
                    gu2: 569,
                    gu3: 1,
                    gu4: '删除',
                    gu5: 0

                }]
            }, {
                ng: '爱果果水果店',
                ng1: '规格',
                ng2: '单价',
                ng3: '数量',
                ng4: '金额',
                ng5: '操作',
                tot: 0,
                list: [{
                    ngs: '云南蒙自石榴8个装',
                    gu1: '8个装',
                    gu2: 569,
                    gu3: 1,
                    gu4: '删除',
                    gu5: 0

                }, {
                    ngs: '云南蒙自石榴8个装',
                    gu1: '8个装',
                    gu2: 569,
                    gu3: 1,
                    gu4: '删除',
                    gu5: 0

                }, {
                    ngs: '云南蒙自石榴8个装',
                    gu1: '8个装',
                    gu2: 569,
                    gu3: 1,
                    gu4: '删除',
                    gu5: 0

                }, {
                    ngs: '云南蒙自石榴8个装',
                    gu1: '8个装',
                    gu2: 569,
                    gu3: 1,
                    gu4: '删除',
                    gu5: 0

                }]
            }],
            address: [{
                    name: '但小兵',
                    ad1: '北京市',
                    ad2: '北京市',
                    ad3: '海淀区',
                    ad4: '天通苑明天第一城4号楼101',
                    phone1: '010-21541589',
                    phone2: '',
                }, {
                    name: '但小兵',
                    ad1: '北京市',
                    ad2: '北京市',
                    ad3: '海淀区',
                    ad4: '天通苑明天第一城4号楼101',
                    phone1: '',
                    phone2: '15032203562',
                }, {
                    name: '但小兵',
                    ad1: '北京市',
                    ad2: '北京市',
                    ad3: '海淀区',
                    ad4: '天通苑明天第一城4号楼101',
                    phone1: '',
                    phone2: '15032203562',
                }, {
                    name: '但小兵',
                    ad1: '北京市',
                    ad2: '北京市',
                    ad3: '海淀区',
                    ad4: '天通苑明天第一城4号楼101',
                    phone1: '',
                    phone2: '15032203562',
                }, {
                    name: '但小兵',
                    ad1: '北京市',
                    ad2: '北京市',
                    ad3: '海淀区',
                    ad4: '天通苑明天第一城4号楼101',
                    phone1: '',
                    phone2: '15032203562',
                }

            ]
        }],
        // },
        comm(state, ary) {
            localStorage.setItem("commonTools", JSON.stringify(ary));
            state.commonTools = ary;
            // console.log(state.commonTools);
        },
    },
    getters: {
        //获取最近访问的常用工具
        getCommonTools: state => {
            let commonTools = localStorage.getItem("commonTools") ? JSON.parse(localStorage.getItem("commonTools")) : new Array()
            if (commonTools.length > 0) {
                state.commonTools = commonTools;
            }
            return state.commonTools
        }
    }
};

const store = new Vuex.Store(module);

export default store;